dropdown: emit notify for selected from the changed callback
authorBenjamin Otte <otte@redhat.com>
Sun, 21 Jun 2020 00:17:47 +0000 (02:17 +0200)
committerBenjamin Otte <otte@redhat.com>
Sun, 21 Jun 2020 00:23:46 +0000 (02:23 +0200)
Otherwise we don't emit it when the selection itself changes it - for
exaple because the model changed.

gtk/gtkdropdown.c

index a95775eab6ca6e49d23e4265fbb81991be836dbd..ef151e720301bac2a2e7c56d93e552ceb33718f6 100644 (file)
@@ -216,6 +216,9 @@ selection_changed (GtkSingleSelection *selection,
   if (GTK_IS_STRING_FILTER (filter))
     gtk_string_filter_set_search (GTK_STRING_FILTER (filter), "");
   gtk_single_selection_set_selected (GTK_SINGLE_SELECTION (self->popup_selection), selected);
+
+  g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_SELECTED]);
+  g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_SELECTED_ITEM]);
 }
 
 static void
@@ -809,9 +812,6 @@ gtk_drop_down_set_selected (GtkDropDown *self,
     return;
 
   gtk_single_selection_set_selected (GTK_SINGLE_SELECTION (self->selection), position);
-
-  g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_SELECTED]);
-  g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_SELECTED_ITEM]);
 }
 
 /**